﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        var loc="";
        $(function () {
            //console.log("Hi!");
            $('#response').hide();
            loc = document.location.origin;
            //console.log(loc);

        });
        function check1()
        {
            $('#response').hide();
            var url = "phch.aspx?ID=79001234567&WAIT=30";
            //console.log(url);
            $.ajax({
                type: "GET",
                url: "phch.aspx?ID=+79001234567&WAIT=30",
                dataType: "html",
                async: true,
                contentType: "text/xml; charset=utf-8",
                success: function (response, status) {
                    //console.log("success");
                },
                error: function (response, status, estatus) {
			
                    //console.log("error: " + status);
                },
                complete: function (response) {
                    //console.log("complete: " + response.responseText);
                    document.getElementById("rtext").innerHTML = "Response was: "+response.responseText;
		    alert(ajax.responseText);
                    $('#response').show();
                }
            });
        }
        function check2()
        {
	alert(1);
		var ajax=new XMLHttpRequest();
			ajax.open("GET","phch.aspx?ID=79001234567&WAIT=30",true);
alert(2);
			ajax.send();
			ajax.onreadystatechange=function(){
alert(ajax.readyState);
				if(ajax.readyState==4 && (ajax.status==200)){
			        alert(ajax.responseText)}

			}
        }
    </script>

</head>
<body>
2012-05-15
    <p>
        <input id="btn1" type="button" value="Проверить $.ajax" onclick="javascvript:check1()" /></p>
    <p>
        <input id="btn2" type="button" value="Проверить ajax.open" onclick="javascvript:check2()" /></p>
        <div id="response"><pre id="rtext">tatata</pre></div>

</body>
</html>
